<?php

/**
 * Requests form.
 *
 * @package    project_midnight
 * @subpackage form
 * @author     AlvaroLara
 */
class RequestsForm extends BaseRequestsForm
{
  public function configure()
  {
    $this->setValidator('email',new sfValidatorEmail());
    $this->validatorSchema->setPostValidator(
          new sfValidatorCallback(array('callback' => array($this, 'checkUsername')))
              );
  }

  public function checkUsername($validator , $values)
  {
    return RequestsPeer::checkAvailability($values['username']);
  }

}
